package com.cooper.service.item;

import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cooper.dao.item.ItemImageDAO;
import com.cooper.entity.ItemImage;

@Service
public class ItemImageService {
	
	@Autowired
	private ItemImageDAO itemImageDao;
	
	public List<ItemImage> getItemImageListByItemId(long itemId) throws Exception{
		return this.itemImageDao.getItemImageListByItemId(itemId);
	}
	
	public Long saveEntity(ItemImage itemImage) throws Exception{
		return this.itemImageDao.saveEntity(itemImage);
	}
	
	public boolean updateEntity(ItemImage itemImage) throws Exception{
		return this.itemImageDao.updateEntity(itemImage);
	}
	
	public ItemImage loadById(long id) throws Exception{
		return this.itemImageDao.loadById(id);
	}
	
	public void deleteImagesNotUsedByItemId(long itemId, Collection<Long> imageIdList){
		this.itemImageDao.deleteImagesNotUsedByItemId(itemId, imageIdList);
	}

}
